package control

import (
	"service/app/dao"
	"service/app/dto"
	"service/app/mode"
)

type CostCont struct {
	BaseContr
	Dao *dao.CostDao
}

var costCont *CostCont

func CostContInit() *CostCont {
	if costCont == nil {
		return &CostCont{
			BaseContr: BaseContr{},
			Dao:       dao.CostDaoInit(),
		}
	}
	return costCont
}

func (m *CostCont) CostAddC(ac *mode.Db_cost) error {
	return m.Dao.CostAddD(ac)
}
func (m *CostCont) CostAllC() (*[]mode.Db_cost, error) {
	return m.Dao.CostAllD()
}
func (m *CostCont) CostEditC(id *dto.ReqUriIdDto, costAc *dto.CostAddDto) error {
	return m.Dao.CostEditD(id, costAc)
}
func (m *CostCont) CostDelC(id *dto.ReqUriIdDto) error {
	return m.Dao.CostDelD(id)
}
func (m *CostCont) CostSearchTimeC(acTime *dto.ReqUriTime, searchRang int) (*[]mode.Db_cost, error) {
	return m.Dao.CostSearchTimeD(acTime, searchRang)
}
